﻿@using HCQ2_Model
@using HCQ2_Common
@{
    ViewBag.Title = "";//作品/头记/校史馆
}
@section headerSection{
    <link href="~/Resources/mainFrame/js/plugins/zTree3/css/metroStyle/metroStyle.css" rel="stylesheet" />
    <script src="~/Resources/mainFrame/js/plugins/zTree3/js/jquery.ztree.core.min.js"></script>
    <script src="~/Resources/mainFrame/js/plugins/zTree3/js/jquery.ztree.excheck.min.js"></script>
    <script src="~/Resources/mainFrame/js/plugins/zTree3/js/jquery.ztree.exedit.min.js"></script>
    <script src="~/Resources/tools/search_zTree.js"></script>
    <style>
        #unitTree {
            width: 400px;
            height: 300px;
            padding: 0;
            border: 1px solid #E7EAEC;
            background-color: #FFFFFF;
            position: fixed;
            z-index: 9;
            overflow: auto;
            display: none;
        }
    </style>
}
<div id="entryHtml" class="wrapper animated fadeInRight autoHeight">
    <!-- Panel Other -->
    <div class="row autoHeight" style="background-color: #fff;">
        <div class="col-sm-12 col-sm-leftRight">
            <form class="form-horizontal m-t" id="orgFormTable" method="post" style="margin-bottom:120px;">
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.vrTitle")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="file_name" name="file_name" type="text" required="" aria-required="true" class="form-control input-sm" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")@LangHelper.GetValue("VRGoodManager.VRCommon.vrTitle")" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.browseNum")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="browse_num" name="browse_num" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.browseNum")" required="" aria-required="true" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.aliasName")：</label>
                    <div class="col-sm-3">
                        <textarea class="form-control" id="alias_name" name="alias_name" rows="2" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")@LangHelper.GetValue("VRGoodManager.VRCommon.aliasName")"></textarea>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.giveNum")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="vr_star" name="vr_star" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.giveNum")"  required="" aria-required="true" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.brief")：</label>
                    <div class="col-sm-3">
                        <textarea class="form-control" id="file_note" name="file_note" rows="2" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")@LangHelper.GetValue("VRGoodManager.VRCommon.brief")"></textarea>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.downloadNum")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="down_number" name="down_number" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.downloadNum")" required="" aria-required="true"  />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.selectRecommended")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="isRecommend" name="isRecommend" data-live-search="true" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.selectRecommended")" required="" aria-required="true">
                            <option value="0" selected>@LangHelper.GetValue("VRGoodManager.VRCloudWork.notRecommended")</option>
                            <option value="1">@LangHelper.GetValue("VRGoodManager.VRCloudWork.recommended")</option>
                        </select>
                        <input type="hidden" id="is_recommend" name="is_recommend" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.commentNum")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="talk_num" name="talk_num" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.commentNum")" required="" aria-required="true"  />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.limits")：</label>
                    <div class="col-sm-3">
                        <select id="folder_limit" name="folder_limit" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCommon.limits")" style="padding: 5px 10px;" required="" aria-required="true">
                            <option value="">@LangHelper.GetValue("GeneralJson.isNull")</option>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.attribute")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="fileStatus" name="fileStatus" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCommon.attribute")" disabled="disabled">
                            <option value="0">@LangHelper.GetValue("VRGoodManager.VRCloudWork.vrPrivate")</option>
                            <option value="1">@LangHelper.GetValue("VRGoodManager.VRCloudWork.vrPublic")</option>
                            <option value="2">@LangHelper.GetValue("VRGoodManager.VRCloudWork.waitApprove")</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("GeneralJson.Edit")：</label>
                    <div class="col-sm-3">
                        <select id="allowEdit" name="allowEdit" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("GeneralJson.Edit")" style="padding: 5px 10px;">
                            <option value="0">@LangHelper.GetValue("VRGoodManager.VRCommon.noEdit")</option>
                            <option value="1">@LangHelper.GetValue("VRGoodManager.VRCommon.accessEdit")</option>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.approveDate")：</label>
                    <div class="col-sm-3">
                        <input id="approve_time" name="approve_time" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.approveDate")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.productionFormat")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="pro_form" name="pro_form" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.productionFormat")">
                            @*<option value="1" selected>VR</option>
                            <option value="2">虚拟仿真</option>
                            <option value="3">AR</option>*@
                        </select>
                        <input type="hidden" id="mater_type" name="mater_type" value="" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.approveUser")：</label>
                    <div class="col-sm-3">
                        <input id="approve_name" name="approve_name" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.approveUser")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.productCategory")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="pro_type" name="pro_type" class="form-control input-sm selectpicker" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.productCategory")">
                            @*<option value="1" selected>VRPPT</option>
                            <option value="2">创客</option>
                            <option value="3">头记</option>
                            <option value="4">校史馆</option>*@
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.lastModifyDate")：</label>
                    <div class="col-sm-3">
                        <input id="update_time" name="update_time" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.lastModifyDate")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.fitClassify")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="file_classify" name="file_classify" class="form-control input-sm selectpicker" data-live-search="true" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.fitClassify")"></select>
                        <!-- 素材类型 -->
                        <input type="hidden" id="file_id" name="file_id" value="" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.lastModifyUser")：</label>
                    <div class="col-sm-3">
                        <input id="update_name" name="update_name" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.lastModifyUser")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.scope")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <input id="folder_name" name="folder_name" type="text" required="" aria-required="true" class="form-control input-sm" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.scope")" />
                        <div id="unitTree" class="col-sm-3"></div>
                        <input id="folder_id" name="folder_id" type="hidden" />
                        <input id="folder_path" name="folder_path" type="hidden" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.upDate")：</label>
                    <div class="col-sm-3">
                        <input id="create_time" name="create_time" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.upDate")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.belongUnit")：</label>
                    <div class="col-sm-3">
                        <select id="unit_code" name="unit_code" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.belongUnit")" style="padding: 5px 10px;">
                            <option value="">@LangHelper.GetValue("GeneralJson.isNull")</option>
                        </select>
                        <input type="hidden" id="org_unit" name="org_unit" />
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.author")：</label>
                    <div class="col-sm-3">
                        <input id="folder_author" name="folder_author" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCloudWork.author")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.code")：</label>
                    <div class="col-sm-3">
                        <input id="file_code" name="file_code"  type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCloudWork.code")"/>
                        <input id="folder_num" name="folder_num"  type="hidden" class="form-control input-sm"/>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.goodSource")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="supplyType" name="supplyType" data-live-search="true" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCommon.goodSource")" required="" aria-required="true">
                            <option value="0" selected>@LangHelper.GetValue("VRGoodManager.VRCommon.personage")</option>
                            <option value="1">@LangHelper.GetValue("VRGoodManager.VRCommon.autotrophy")</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.status")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                    <div class="col-sm-3">
                        <select id="file_status" name="file_status" data-live-search="true" class="form-control input-sm selectpicker" disabled="disabled" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCloudWork.status")" required="" aria-required="true">
                            <option value="0">@LangHelper.GetValue("VRGoodManager.VRCloudWork.vrPrivate")</option>
                            <option value="1">@LangHelper.GetValue("VRGoodManager.VRCloudWork.waitApprove")</option>
                            <option value="3">@LangHelper.GetValue("VRGoodManager.VRCloudWork.freeShare")</option>
                            <option value="4">@LangHelper.GetValue("VRGoodManager.VRCloudWork.removeSth")</option>
                            <option value="5">@LangHelper.GetValue("VRGoodManager.VRCloudWork.hasBeenOn")</option>
                            <option value="6">@LangHelper.GetValue("VRGoodManager.VRCloudWork.Unapprove")</option>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.price")：</label>
                    <div class="col-sm-3">
                        <input id="file_money" name="file_money" disabled="disabled" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCloudWork.price")" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCloudWork.number")：</label>
                    <div class="col-sm-3">
                        <input id="file_order" name="file_order" onblur="help.int('file_order')" type="text" class="form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCloudWork.number")" />
                    </div>                   
                </div>
                <div class="form-group isHeader">
                    <label class="col-sm-3 control-label isHeader">@LangHelper.GetValue("VRGoodManager.VRCommon.matchWare")：</label>
                    <div class="col-sm-3">
                        <select id="is_game" name="is_game" data-live-search="true" class="form-control input-sm selectpicker" placeholder="@LangHelper.GetValue("GeneralJson.pleaseSelect")@LangHelper.GetValue("VRGoodManager.VRCommon.matchWare")" required="" aria-required="true">
                            <option value="0" selected>@LangHelper.GetValue("GeneralJson.No")</option>
                            <option value="1">@LangHelper.GetValue("GeneralJson.Yes")</option>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.matchStartDate")：</label>
                    <div class="col-sm-3">
                        <input id="gameStart" name="gameStart" type="text" class="laydate-icon form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.matchStartDate")" onclick="laydate({ istime: true, format: 'YYYY-MM-DD hh:mm:ss' })" />
                    </div>
                </div>
                <div class="form-group isHeader">                    
                    <label class="col-sm-3 control-label">@LangHelper.GetValue("VRGoodManager.VRCommon.matchEndDate")：</label>
                    <div class="col-sm-3">
                        <input id="gameEnd" name="gameEnd" type="text" class="laydate-icon form-control input-sm" placeholder="@LangHelper.GetValue("VRGoodManager.VRCommon.matchEndDate")" onclick="laydate({ istime: true, format: 'YYYY-MM-DD hh:mm:ss' })" />
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                    @{
                        List<T_VRGoodDisiPrice> priceList = (List<T_VRGoodDisiPrice>)ViewBag.goodPrice;
                        int goodStatus = ViewBag.goodStatus;
                        if (priceList.Count > 0)
                        {
                            for (int i = 0; i < priceList.Count; i += 2)
                            {
                                int j = i;
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">@priceList[j].op_month@LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                    <div class="col-sm-3">
                                        <input id="file_price" name="file_price" type="text" op_month="@priceList[j].op_month" class="form-control input-sm filePrice" placeholder="@priceList[j].op_month@LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")" required="" aria-required="true" value="@priceList[j].ori_price" />
                                    </div>
                                    @{
                                j++;
                                if (priceList.Count > j)
                                {
                                <label class="col-sm-2 control-label">@priceList[j].op_month@LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                <div class="col-sm-3">
                                    <input id="file_price" name="file_price" type="text" op_month="@priceList[j].op_month" class="form-control input-sm filePrice" placeholder="@priceList[j].op_month@LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")" required="" aria-required="true" value="@priceList[j].ori_price" />
                                </div>
                                }
                                    }
                                </div>
                                            }
                                        }
                                        else if (goodStatus != 0)
                                        {
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">1 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                                <div class="col-sm-3">
                                                    <input id="file_price" name="file_price" type="text" op_month="1" class="form-control input-sm filePrice" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")1 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")" />
                                                </div>
                                                <label class="col-sm-2 control-label">3 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                                <div class="col-sm-3">
                                                    <input id="file_price" name="file_price" type="text" op_month="3" class="form-control input-sm filePrice" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")3 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")"/>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">6 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                                <div class="col-sm-3">
                                                    <input id="file_price" name="file_price" type="text" op_month="6" class="form-control input-sm filePrice" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")6 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")"/>
                                                </div>
                                                <label class="col-sm-2 control-label">12 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")<span class="glyphicon glyphicon-asterisk requiredtitle"></span>：</label>
                                                <div class="col-sm-3">
                                                    <input id="file_price" name="file_price" type="text" op_month="12" class="form-control input-sm filePrice" required="" aria-required="true" placeholder="@LangHelper.GetValue("GeneralJson.pleaseImport")12 @LangHelper.GetValue("VRGoodManager.VRCommon.monthMoney")" />
                                                </div>
                                            </div>
                                        }
                    }
</form>
        </div>
    </div>
</div>
@section footSection{
    <script>
        var fileId, isread, isFolder = false, doc_type, pageType, pro_type;
        var entryType = $.getUrls("entryType"), $file_status;
        var unitzTree, isHeader = false;//是否为头记课件
        var entryManager = {
            initPage: function () {
                showLoadBoxs();
                if (!entryManager.initData())
                    return false;
                entryManager.bindZtree();
                entryManager.initSelect();
                entryManager.initForm();
                entryManager.bindEvent();
                delLoadBoxs();
            },
            initData: function () {
                fileId = $.getUrls("file_id");
                isread = $.getUrls("read");
                isHeader = $.getUrls("isHeader");
                if (!fileId) {
                    layer.msg("ID Error！");
                    return false;
                }
                pageType = $.getUrls("pageType");
                doc_type = $.getUrls("doc_type");
                pro_type = $.getUrls("pro_type");
                if (!pageType)
                    pageType = "";
                //待审核时去掉所属项目
                if (doc_type === 5)
                    pageType = "";
                //判断是否需要隐藏头记字段
                if (!isHeader || isHeader != "ok") 
                    $('.isHeader').css("display", "none");
                else if (isHeader && isHeader === "ok")
                    $('.isHeader').css("display", "block");
                return true;
            },
            initSelect: function () {
                //产品类别
                $('#pro_type').initSelectcontrol("vrProType");
                //作品格式
                $('#pro_form').initSelectcontrol("vrProForm");
                $('#file_classify').initSelectcontrol("docClassify");
                $('#folder_limit').initSelectcontrol("docLimits");
                $.ajax({
                    url: ctx + '/SysCommon/GetDictionaryByCode',
                    type: "post",
                    cache: false,
                    async: false,
                    data: { fieldCode: 'SysUserUnit' },
                    dataType: 'json',
                    success: function (data) {
                        if (data.Statu === 1) {
                            layer.msg(data.Msg, { icon: 5 });
                            return false;
                        }
                        var itemStr = "";
                        $.each(data.Data, function (i, item) {
                            itemStr += "<option value='" + item.code_value + "'>" + item.code_name + "</option>";
                        });
                        $('#unit_code').append(itemStr);
                        $('.selectpicker').selectpicker({ size: 6 });
                        $('.selectpicker').selectpicker('refresh');
                    },
                    error: function () {
                        layer.msg(Lang.GeneralJson.dataException, { icon: 5 });
                    }
                });
                //初始化状态
                if (entryType && entryType === "approve") {
                    var fileStatus = "<option value='5' selected=''>" + Lang.GeneralJson.pass + "</option><option value='6'>" + Lang.GeneralJson.noPass + "</option>";
                    $("#file_status").removeAttr("disabled");//开启状
                    $("#file_status").empty();
                    $('#file_status').selectpicker('refresh');
                    $('#file_status').append(fileStatus);
                    $('#file_status').selectpicker('refresh');
                }
            },
            initForm: function () {
                $('#orgFormTable').resetHideValidForm();
                $.ajax({
                    type: 'post',
                    url: ctx + '/SourceManager/GetEntryData/' + fileId,
                    dataType: 'json',
                    async: false,
                    success: function (data) {
                        if (data.Statu === 0) {
                            var result = data.Data.info, folder = data.Data.folder;
                            $file_status = result.file_status;
                            if (result) {
                                if (entryType && entryType === "approve") {
                                    //审核
                                    result["isRecommend"] = "0";//默认推荐
                                    result.file_status = "5";//默认审核通过
                                } else {
                                    if (result.is_recommend)
                                        result["isRecommend"] = "1";
                                    else
                                        result["isRecommend"] = "0";
                                }
                                if (result.approve_time)
                                    result.approve_time = $.formatByDate(result.approve_time);
                                if (result.update_time)
                                    result.update_time = $.formatByDate(result.update_time);
                                if (result.create_time)
                                    result.create_time = $.formatByDate(result.create_time);
                                if (result.allow_edit)
                                    result["allowEdit"] = "1";
                                else
                                    result["allowEdit"] = "0";
                                switch (result.file_status) {
                                    case 0:
                                    case 1:
                                    case 3:
                                    case 5: $('#fileStatus').removeAttr("disabled"); break;
                                    default: $('#fileStatus').attr("disabled", "disabled"); break;
                                }
                                if (result.file_status != 0)
                                    result["fileStatus"] = "1";
                                else
                                    result["fileStatus"] = "0";
                            }
                            $('#orgFormTable')[0].reset();//重置表单
                            $('#orgFormTable').LoadForm(result);//表单填充数据
                            $('#folder_name').val(folder.folder_name);
                            $('#folder_id').val(folder.folder_id);
                            $('#folder_path').val(folder.folder_path);
                            if(result.game_start && isHeader === "ok")
                                $('#gameStart').val($.formatByDateLog(result.game_start));
                            if (result.game_end && isHeader === "ok")
                                $('#gameEnd').val($.formatByDateLog(result.game_end));
                            //判断是否只读
                            if (isread) {
                                //只读
                                $('#orgFormTable').find("input,textarea").attr("disabled", true);
                                $('#orgFormTable').find("select").next("div").children("button").attr("disabled", true);
                            }
                            $('button.disabled ').css("background-color", "#EEEEEE");
                        }
                        else
                            layer.msg(data.Msg, { icon: 5 });
                    }
                });
            },
            saveForm: function (indexForm) {
                if ($('#orgFormTable').valid()) {
                    var allow_edit = ($('#allowEdit').val() === "0") ? false : true, fileStatus = $('#fileStatus').attr("disabled");
                    var filePrice = $('.filePrice'), listPrice = [];
                    $.each(filePrice, function (index,item) {
                        listPrice.push({
                            op_month: $(item).attr("op_month"),
                            file_price: $(item).val()
                        });
                    });
                    var $data = {
                        allow_edit: allow_edit,
                        status: $('#fileStatus').val(),
                        file_status: $('#file_status').val(),
                        all_status: $file_status,
                        entryType: entryType,
                        saveType: 'other',
                        listPrice: listPrice,
                        isHeader: isHeader
                    };
                    //推荐
                    var isRecommend = $('#isRecommend').val();
                    if (isRecommend === "1")
                        $('#is_recommend').val(true);
                    else
                        $('#is_recommend').val(false);
                    if (fileStatus)
                        $data["fileStatus"] = $('#file_status').val();
                    //验证通过
                    if (!$('#file_code').val()) {
                        layer.alert(Lang.GeneralJson.mustInputMessage);
                        return false;
                    }
                    //验证是否为头记
                    if (isHeader && isHeader === "ok") {
                        var is_game = $('#is_game').val(),
                            game_start=$('#gameStart').val(),
                            game_end=$('#gameEnd').val();
                        if (is_game && is_game === "1") {
                            if (!game_start) {
                                layer.alert(Lang.VRGoodManager.VRCommon.matchStartDate + Lang.GeneralJson.mustInputMessage, { icon: 5 });
                                return false;
                            }
                            if (!game_end) {
                                layer.alert(Lang.VRGoodManager.VRCommon.matchEndDate + Lang.GeneralJson.mustInputMessage, { icon: 5 });
                                return false;
                            }
                        }
                        $data["game_start"] = game_start;
                        $data["game_end"] = game_end;
                    }
                    //单位名称
                    $('#org_unit').val($('#unit_code').find("option:selected").text());//所属单位 名称
                    $('#orgFormTable').ajaxSubmit({
                        url: ctx + '/SourceManager/SaveEntryData',
                        type: "post",
                        data: $data,
                        dataType: "json",
                        beforeSubmit: function (arr, $form, options) {
                            layer.msg(Lang.GeneralJson.submitData, { icon: 1, time: 5000 });
                        },
                        success: function (result, status, xhr, $form) {
                            if (result.Statu === 0) {
                                layer.msg(Lang.GeneralJson.modifySuccess, { icon: 6 });
                                window.parent.docManager.closeIndexForm(indexForm);
                                return true;
                            }
                            else {
                                layer.alert(result.Msg, { icon: 5 });
                                return false;
                            }
                        },
                        error: function (xhr, status, error, $form) {
                            layer.msg(Lang.GeneralJson.saveError, { icon: 5 });
                        }
                    });
                } else {
                    layer.msg(Lang.GeneralJson.mustInputMessage, { icon: 5 });
                    return false;
                }
            },
            //绑定事件
            bindEvent:function(){
                $('#folder_name').on('click', function (event) {
                    if (!isFolder) {
                        //打开
                        $('#unitTree').slideDown();
                        isFolder = true;
                    } else {
                        //关闭
                        $('#unitTree').slideUp();
                        isFolder = false;
                    }
                    event.stopPropagation();
                });
                $('#entryHtml').on('click', function () {
                    //if (isFolder) {
                    //    $('#unitTree').slideUp();
                    //    isFolder = false;
                    //}
                });
            },
            //素材、作品树
            //2.2采用Ztree初始化文档树
            bindZtree: function () {
                var setting = {
                    view: {
                        showIcon: true,
                        selectedMulti: false,
                        fontCss: getFontCss
                    },
                    edit: {
                        enable: true,
                        showRemoveBtn: false,
                        showRenameBtn: false
                    },
                    async: {
                        enable: true,
                        dataType: "text",
                        type: "post",
                        url: ctx + "/DocManager/GetDocTreeData?pro_type=" + pro_type + "&doc_type=" + doc_type + "&isNum=1&pageType=" + pageType,
                        autoParam: ["id"]
                    },
                    data: {
                        key: { title: "name", name: "name" },
                        simpleData: { enable: true, idKey: "id", pIdKey: "pId", rootPId: 0 }
                    },
                    check: {
                        enable: false,
                        autoCheckTrigger: true,
                        chkStyle: "checkbox",
                        chkboxType: { "Y": "p", "N": "ps" }
                    },
                    callback: {
                        onAsyncError: function () {
                            layer.msg(Lang.GeneralJson.initUnitError, { icon: 5 });
                        },
                        onAsyncSuccess: function (event, treeId, treeNode, msg) {
                        },
                        onClick: function (event, treeId, treeNode) {
                            $('#unitTree a').css("color", "#333");
                            $('#' + treeNode.tId + '_a').css("color", "#ffffff");
                            $('#folder_id').val(treeNode.id);
                            $('#folder_path').val(treeNode.folder_path);
                            $('#unitTree').slideUp();
                            var folderName = treeNode.name;
                            if (folderName.indexOf('(') > -1)
                                $('#folder_name').val(folderName.substring(0, folderName.indexOf('(')));
                            else
                                $('#folder_name').val(folderName);
                            isFolder = false;
                        }
                    }
                };
                unitzTree = $("#unitTree").initzTreeView(setting, 'ushow');
            }
        }
        $(function(){
            //初始化Page
            entryManager.initPage();
        });
    </script>
}